package com.ys.nms.module.business.dal.mysql.companyproperty;

import com.ys.nms.framework.common.pojo.PageResult;
import com.ys.nms.framework.mybatis.core.mapper.BaseMapperX;
import com.ys.nms.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.ys.nms.module.business.controller.admin.companyProperty.vo.CompanyPropertyPageReqVO;
import com.ys.nms.module.business.dal.dataobject.companyproperty.CompanyPropertyDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 资产 Mapper
 *
 * @author 超级管理员
 */
@Mapper
public interface CompanyPropertyMapper extends BaseMapperX<CompanyPropertyDO> {

    default PageResult<CompanyPropertyDO> selectPage(CompanyPropertyPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CompanyPropertyDO>()
                .likeIfPresent(CompanyPropertyDO::getHostName, reqVO.getHostName())
                .likeIfPresent(CompanyPropertyDO::getName, reqVO.getName())
                .eqIfPresent(CompanyPropertyDO::getDeviceType, reqVO.getDeviceType())
                .inIfPresent(CompanyPropertyDO::getArea, reqVO.getArea())
                .inIfPresent(CompanyPropertyDO::getId, reqVO.getIdList())
                .betweenIfPresent(CompanyPropertyDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(CompanyPropertyDO::getId));
    }

}